<template>
    <div>
        <van-swipe :autoplay="3000">
            <van-swipe-item v-for="item in dataLisa" :key="item.bannerid" width="400px" height="600px">
                <img :src="item.img" style="width: 100%; height: 100%;" />
            </van-swipe-item>
        </van-swipe>
    </div>
</template>
<script setup lang="ts">
import { onMounted, reactive, ref } from 'vue';
import { viewBanner } from '../api/home'
type data = {
    bannerid: string,
    img: string,

}
let dataLisa = ref<Array<data>>([])
// 初始化请求数据
onMounted(async () => {
    let res = await viewBanner()
    console.log(res);
    if (res.code != '200') {
        return
    }
    dataLisa.value = res.data

})
</script>

<style scoped>
.van-swipe {
    height: 200px;
    width: 100vw;
}

.van-swipe>img {
    width: 100%;
    height: 100%;
}

.van-swipe .van-swipe__track {
    background-color: red;
    width: 400px;
}
</style>